(function(){


  let id = 1;
  // 请求数据
  let url = "http://81.70.162.221:3000/getBlog?id=" + id;
  axios.get(url).then(function(res){
    let blog = res.data;
    console.log(blog);
  })
  

    let btnPost = document.querySelector('#btn-post')
    btnPost.addEventListener('click', function(){
      let nicknameInput = document.querySelector('#nickname')
      let emailInput = document.querySelector('#email')
      let contentInput = document.querySelector('#content')
  
      axios.post('http://81.70.162.221:3000/postComment', {
        nickname: nicknameInput.value,
        email: emailInput.value, 
        content: contentInput.value, 
        articleId: id
      }).then(function(res){
        if(res.data == 'success'){
          console.log('1111');
        }
      });
    }, false)
  
  })();